#pragma once
#include "afxcmn.h"
#include "afxwin.h"

#include <vector>

// CManageQuestionDlg dialog

class CManageQuestionDlg : public CDialog
{
    DECLARE_DYNAMIC(CManageQuestionDlg)

public:
    CManageQuestionDlg(CWnd* pParent = NULL);   // standard constructor
    virtual ~CManageQuestionDlg();

// Dialog Data
    enum { IDD = IDD_ManageQuestionLibrary };

protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

    DECLARE_MESSAGE_MAP()
    CTreeCtrl m_treeQuestionType;
    CListCtrl m_listQuestions;
    CButton m_addButton;
    CButton m_editButton;
    CButton m_deleteButton;
    CButton m_exitButton;

    HTREEITEM m_questionTypeItems[ExamSystem::QuestionTypeCount];
    HTREEITEM m_libraryStatusItem;

    std::vector<ExamSystem::QuestionBase> m_questionTitles;
    ExamSystem::QuestionType m_currentType;

    void SelectRightQuestionType(void);
    void UpdateQuestionTypes(void);
    void EditAddQuestion(bool bAdd);
    virtual void OnOK();
public:
    void Initialize(void);

public:
    afx_msg void OnBnClickedCancel();
    afx_msg void OnBnClickedButtonAddItem();
    afx_msg void OnBnClickedButtonEditItem();
    afx_msg void OnBnClickedButtonDeleteItem();
    afx_msg void OnSize(UINT nType, int cx, int cy);
    virtual BOOL OnInitDialog();
    virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
    virtual void OnCancel();
public:
    afx_msg void OnTvnSelchangedTreeQuestionType(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg void OnHdnItemKeyDownListQuestions(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg void OnNMClickListQuestions(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg void OnNMDblclkListQuestions(NMHDR *pNMHDR, LRESULT *pResult);
};

